#include "GateWayDispatcher.h"
#include "handler/AccountHandler.h"
#include "opcode/OpcodeIn.h"
void GateWayDispatcher::init() {
	fCallback[CMD_LOGIN] = &AccountHandler::handleLogin;
}

GateWayDispatcher::GateWayDispatcher() {
	init();
}

GateWayDispatcher::~GateWayDispatcher() {
}

int GateWayDispatcher::handle(connection_t ctx, char* buf, int len) {
	if (fCallback[CMD_LOGIN] != 0) {
		ByteArray buffer(buf, len);
		return (*fCallback[CMD_LOGIN])(ctx, buffer);
	}
	return -1;
}
/*
 * GateWayDispatcher.cpp
 *
 *  Created on: Sep 13, 2016
 *      Author: root
 */

